const path=require("path")
const multer=require("multer")
const storage=multer.diskStorage({
     destination:function(req,file,cb){
            // console.log(file)
            cb(null,path.join(__dirname,"../"+"public/videos"))//上传文件的保存路径
     },
     filename:function(req,file,cb){
        // console.log(file)
        let fileFormat=(file.originalname).split(".");
            //    console.log(fileFormat)
             cb(null,fileFormat[0]+"-"+Date.now()+"."+fileFormat[fileFormat.length-1])
     }
})
const uploadVideo=multer({
      storage:storage
})
module.exports=uploadVideo